#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;

class Solution {
public:
    int compress(vector<char>& chars) {
        int ret = 0;
        vector<int> arr(128, 0);
        for (int idx = 0; idx < chars.size(); idx++) {
            arr[chars[idx]]++;
        }
        chars.clear();
        string str;
        for (int idx = 0; idx < 128; idx++) {
            if (arr[idx] != 0) {
                str.push_back(static_cast<char>(idx));
                if (arr[idx] != 1) {
                    str += to_string(arr[idx]);
                }
            }
        }
        for (auto ch : str) {
            chars.push_back(ch);
        }
        return chars.size();
    }
};

int main()
{   
    Solution s;
    vector<char> chars{'a','b','b','b','b','b','b','b','b','b','b','b','b'};
    cout << s.compress(chars) << endl;
    return 0;
}